Optimal. Leaf size=353 \[ \left (a^3 (A c-c C-B d)-3 a b^2 (A c-c C-B d)-3 a^2 b (B c+(A-C) d)+b^3 (B c+(A-C) d)\right ) x-\frac {\left (3 a^2 b (A c-c C-B d)-b^3 (A c-c C-B d)+a^3 (B c+(A-C) d)-3 a b^2 (B c+(A-C) d)\right ) \log (\cos (e+f x))}{f}+\frac {b \left (2 a b (A c-c C-B d)+a^2 (B c+(A-C) d)-b^2 (B c+(A-C) d)\right ) \tan (e+f x)}{f}+\frac {(A b c+a B c-b c C+a A d-b B d-a C d) (a+b \tan (e+f x))^2}{2 f}+\frac {(B c+(A-C) d) (a+b \tan (e+f x))^3}{3 f}-\frac {(a C d-5 b (c C+B d)) (a+b \tan (e+f x))^4}{20 b^2 f}+\frac {C d \tan (e+f x) (a+b \tan (e+f x))^4}{5 b f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.55, antiderivative size = 353, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 43, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.116, Rules used = {3718, 3711,
3609, 3606, 3556} \begin {gather*} \frac {b \tan (e+f x) \left (a^2 (d (A-C)+B c)+2 a b (A c-B d-c C)-b^2 (d (A-C)+B c)\right )}{f}-\frac {\log (\cos (e+f x)) \left (a^3 (d (A-C)+B c)+3 a^2 b (A c-B d-c C)-3 a b^2 (d (A-C)+B c)-b^3 (A c-B d-c C)\right )}{f}+x \left (a^3 (A c-B d-c C)-3 a^2 b (d (A-C)+B c)-3 a b^2 (A c-B d-c C)+b^3 (d (A-C)+B c)\right )+\frac {(d (A-C)+B c) (a+b \tan (e+f x))^3}{3 f}+\frac {(a+b \tan (e+f x))^2 (a A d+a B c-a C d+A b c-b B d-b c C)}{2 f}-\frac {(a C d-5 b (B d+c C)) (a+b \tan (e+f x))^4}{20 b^2 f}+\frac {C d \tan (e+f x) (a+b \tan (e+f x))^4}{5 b f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rule 3711
Rule 3718
Rubi steps
\begin {align*} \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx &=\frac {C d \tan (e+f x) (a+b \tan (e+f x))^4}{5 b f}-\frac {\int (a+b \tan (e+f x))^3 \left (-5 A b c+a C d-5 b (B c+(A-C) d) \tan (e+f x)+(a C d-5 b (c C+B d)) \tan ^2(e+f x)\right ) \, dx}{5 b}\\ &=-\frac {(a C d-5 b (c C+B d)) (a+b \tan (e+f x))^4}{20 b^2 f}+\frac {C d \tan (e+f x) (a+b \tan (e+f x))^4}{5 b f}-\frac {\int (a+b \tan (e+f x))^3 (-5 b (A c-c C-B d)-5 b (B c+(A-C) d) \tan (e+f x)) \, dx}{5 b}\\ &=\frac {(B c+(A-C) d) (a+b \tan (e+f x))^3}{3 f}-\frac {(a C d-5 b (c C+B d)) (a+b \tan (e+f x))^4}{20 b^2 f}+\frac {C d \tan (e+f x) (a+b \tan (e+f x))^4}{5 b f}-\frac {\int (a+b \tan (e+f x))^2 (5 b (b B c+b (A-C) d-a (A c-c C-B d))-5 b (A b c+a B c-b c C+a A d-b B d-a C d) \tan (e+f x)) \, dx}{5 b}\\ &=\frac {(A b c+a B c-b c C+a A d-b B d-a C d) (a+b \tan (e+f x))^2}{2 f}+\frac {(B c+(A-C) d) (a+b \tan (e+f x))^3}{3 f}-\frac {(a C d-5 b (c C+B d)) (a+b \tan (e+f x))^4}{20 b^2 f}+\frac {C d \tan (e+f x) (a+b \tan (e+f x))^4}{5 b f}-\frac {\int (a+b \tan (e+f x)) \left (-5 b \left (a^2 (A c-c C-B d)-b^2 (A c-c C-B d)-2 a b (B c+(A-C) d)\right )-5 b \left (2 a b (A c-c C-B d)+a^2 (B c+(A-C) d)-b^2 (B c+(A-C) d)\right ) \tan (e+f x)\right ) \, dx}{5 b}\\ &=\left (a^3 (A c-c C-B d)-3 a b^2 (A c-c C-B d)-3 a^2 b (B c+(A-C) d)+b^3 (B c+(A-C) d)\right ) x+\frac {b \left (2 a b (A c-c C-B d)+a^2 (B c+(A-C) d)-b^2 (B c+(A-C) d)\right ) \tan (e+f x)}{f}+\frac {(A b c+a B c-b c C+a A d-b B d-a C d) (a+b \tan (e+f x))^2}{2 f}+\frac {(B c+(A-C) d) (a+b \tan (e+f x))^3}{3 f}-\frac {(a C d-5 b (c C+B d)) (a+b \tan (e+f x))^4}{20 b^2 f}+\frac {C d \tan (e+f x) (a+b \tan (e+f x))^4}{5 b f}-\left (-3 a^2 b (A c-c C-B d)+b^3 (A c-c C-B d)-a^3 (B c+(A-C) d)+3 a b^2 (B c+(A-C) d)\right ) \int \tan (e+f x) \, dx\\ &=\left (a^3 (A c-c C-B d)-3 a b^2 (A c-c C-B d)-3 a^2 b (B c+(A-C) d)+b^3 (B c+(A-C) d)\right ) x-\frac {\left (3 a^2 b (A c-c C-B d)-b^3 (A c-c C-B d)+a^3 (B c+(A-C) d)-3 a b^2 (B c+(A-C) d)\right ) \log (\cos (e+f x))}{f}+\frac {b \left (2 a b (A c-c C-B d)+a^2 (B c+(A-C) d)-b^2 (B c+(A-C) d)\right ) \tan (e+f x)}{f}+\frac {(A b c+a B c-b c C+a A d-b B d-a C d) (a+b \tan (e+f x))^2}{2 f}+\frac {(B c+(A-C) d) (a+b \tan (e+f x))^3}{3 f}-\frac {(a C d-5 b (c C+B d)) (a+b \tan (e+f x))^4}{20 b^2 f}+\frac {C d \tan (e+f x) (a+b \tan (e+f x))^4}{5 b f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 5.85, size = 280, normalized size = 0.79 \begin {gather*} \frac {\frac {3 (-a C d+5 b (c C+B d)) (a+b \tan (e+f x))^4}{b}+12 C d \tan (e+f x) (a+b \tan (e+f x))^4+30 (A b c-a B c-b c C-a A d-b B d+a C d) \left ((i a-b)^3 \log (i-\tan (e+f x))-(i a+b)^3 \log (i+\tan (e+f x))+6 a b^2 \tan (e+f x)+b^3 \tan ^2(e+f x)\right )-10 (B c+(A-C) d) \left (3 i (a+i b)^4 \log (i-\tan (e+f x))-3 i (a-i b)^4 \log (i+\tan (e+f x))+6 b^2 \left (-6 a^2+b^2\right ) \tan (e+f x)-12 a b^3 \tan ^2(e+f x)-2 b^4 \tan ^3(e+f x)\right )}{60 b f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.21, size = 639, normalized size = 1.81 Too large to display
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 423, normalized size = 1.20 \begin {gather*} \frac {12 \, C b^{3} d \tan \left (f x + e\right )^{5} + 15 \, {\left (C b^{3} c + {\left (3 \, C a b^{2} + B b^{3}\right )} d\right )} \tan \left (f x + e\right )^{4} + 20 \, {\left ({\left (3 \, C a b^{2} + B b^{3}\right )} c + {\left (3 \, C a^{2} b + 3 \, B a b^{2} + {\left (A - C\right )} b^{3}\right )} d\right )} \tan \left (f x + e\right )^{3} + 30 \, {\left ({\left (3 \, C a^{2} b + 3 \, B a b^{2} + {\left (A - C\right )} b^{3}\right )} c + {\left (C a^{3} + 3 \, B a^{2} b + 3 \, {\left (A - C\right )} a b^{2} - B b^{3}\right )} d\right )} \tan \left (f x + e\right )^{2} + 60 \, {\left ({\left ({\left (A - C\right )} a^{3} - 3 \, B a^{2} b - 3 \, {\left (A - C\right )} a b^{2} + B b^{3}\right )} c - {\left (B a^{3} + 3 \, {\left (A - C\right )} a^{2} b - 3 \, B a b^{2} - {\left (A - C\right )} b^{3}\right )} d\right )} {\left (f x + e\right )} + 30 \, {\left ({\left (B a^{3} + 3 \, {\left (A - C\right )} a^{2} b - 3 \, B a b^{2} - {\left (A - C\right )} b^{3}\right )} c + {\left ({\left (A - C\right )} a^{3} - 3 \, B a^{2} b - 3 \, {\left (A - C\right )} a b^{2} + B b^{3}\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 60 \, {\left ({\left (C a^{3} + 3 \, B a^{2} b + 3 \, {\left (A - C\right )} a b^{2} - B b^{3}\right )} c + {\left (B a^{3} + 3 \, {\left (A - C\right )} a^{2} b - 3 \, B a b^{2} - {\left (A - C\right )} b^{3}\right )} d\right )} \tan \left (f x + e\right )}{60 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.48, size = 421, normalized size = 1.19 \begin {gather*} \frac {12 \, C b^{3} d \tan \left (f x + e\right )^{5} + 15 \, {\left (C b^{3} c + {\left (3 \, C a b^{2} + B b^{3}\right )} d\right )} \tan \left (f x + e\right )^{4} + 20 \, {\left ({\left (3 \, C a b^{2} + B b^{3}\right )} c + {\left (3 \, C a^{2} b + 3 \, B a b^{2} + {\left (A - C\right )} b^{3}\right )} d\right )} \tan \left (f x + e\right )^{3} + 60 \, {\left ({\left ({\left (A - C\right )} a^{3} - 3 \, B a^{2} b - 3 \, {\left (A - C\right )} a b^{2} + B b^{3}\right )} c - {\left (B a^{3} + 3 \, {\left (A - C\right )} a^{2} b - 3 \, B a b^{2} - {\left (A - C\right )} b^{3}\right )} d\right )} f x + 30 \, {\left ({\left (3 \, C a^{2} b + 3 \, B a b^{2} + {\left (A - C\right )} b^{3}\right )} c + {\left (C a^{3} + 3 \, B a^{2} b + 3 \, {\left (A - C\right )} a b^{2} - B b^{3}\right )} d\right )} \tan \left (f x + e\right )^{2} - 30 \, {\left ({\left (B a^{3} + 3 \, {\left (A - C\right )} a^{2} b - 3 \, B a b^{2} - {\left (A - C\right )} b^{3}\right )} c + {\left ({\left (A - C\right )} a^{3} - 3 \, B a^{2} b - 3 \, {\left (A - C\right )} a b^{2} + B b^{3}\right )} d\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 60 \, {\left ({\left (C a^{3} + 3 \, B a^{2} b + 3 \, {\left (A - C\right )} a b^{2} - B b^{3}\right )} c + {\left (B a^{3} + 3 \, {\left (A - C\right )} a^{2} b - 3 \, B a b^{2} - {\left (A - C\right )} b^{3}\right )} d\right )} \tan \left (f x + e\right )}{60 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 1001 vs.
\(2 (316) = 632\).
time = 0.35, size = 1001, normalized size = 2.84 \begin {gather*} \begin {cases} A a^{3} c x + \frac {A a^{3} d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 A a^{2} b c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - 3 A a^{2} b d x + \frac {3 A a^{2} b d \tan {\left (e + f x \right )}}{f} - 3 A a b^{2} c x + \frac {3 A a b^{2} c \tan {\left (e + f x \right )}}{f} - \frac {3 A a b^{2} d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 A a b^{2} d \tan ^{2}{\left (e + f x \right )}}{2 f} - \frac {A b^{3} c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {A b^{3} c \tan ^{2}{\left (e + f x \right )}}{2 f} + A b^{3} d x + \frac {A b^{3} d \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {A b^{3} d \tan {\left (e + f x \right )}}{f} + \frac {B a^{3} c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - B a^{3} d x + \frac {B a^{3} d \tan {\left (e + f x \right )}}{f} - 3 B a^{2} b c x + \frac {3 B a^{2} b c \tan {\left (e + f x \right )}}{f} - \frac {3 B a^{2} b d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 B a^{2} b d \tan ^{2}{\left (e + f x \right )}}{2 f} - \frac {3 B a b^{2} c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 B a b^{2} c \tan ^{2}{\left (e + f x \right )}}{2 f} + 3 B a b^{2} d x + \frac {B a b^{2} d \tan ^{3}{\left (e + f x \right )}}{f} - \frac {3 B a b^{2} d \tan {\left (e + f x \right )}}{f} + B b^{3} c x + \frac {B b^{3} c \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {B b^{3} c \tan {\left (e + f x \right )}}{f} + \frac {B b^{3} d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {B b^{3} d \tan ^{4}{\left (e + f x \right )}}{4 f} - \frac {B b^{3} d \tan ^{2}{\left (e + f x \right )}}{2 f} - C a^{3} c x + \frac {C a^{3} c \tan {\left (e + f x \right )}}{f} - \frac {C a^{3} d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {C a^{3} d \tan ^{2}{\left (e + f x \right )}}{2 f} - \frac {3 C a^{2} b c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 C a^{2} b c \tan ^{2}{\left (e + f x \right )}}{2 f} + 3 C a^{2} b d x + \frac {C a^{2} b d \tan ^{3}{\left (e + f x \right )}}{f} - \frac {3 C a^{2} b d \tan {\left (e + f x \right )}}{f} + 3 C a b^{2} c x + \frac {C a b^{2} c \tan ^{3}{\left (e + f x \right )}}{f} - \frac {3 C a b^{2} c \tan {\left (e + f x \right )}}{f} + \frac {3 C a b^{2} d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 C a b^{2} d \tan ^{4}{\left (e + f x \right )}}{4 f} - \frac {3 C a b^{2} d \tan ^{2}{\left (e + f x \right )}}{2 f} + \frac {C b^{3} c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {C b^{3} c \tan ^{4}{\left (e + f x \right )}}{4 f} - \frac {C b^{3} c \tan ^{2}{\left (e + f x \right )}}{2 f} - C b^{3} d x + \frac {C b^{3} d \tan ^{5}{\left (e + f x \right )}}{5 f} - \frac {C b^{3} d \tan ^{3}{\left (e + f x \right )}}{3 f} + \frac {C b^{3} d \tan {\left (e + f x \right )}}{f} & \text {for}\: f \neq 0 \\x \left (a + b \tan {\left (e \right )}\right )^{3} \left (c + d \tan {\left (e \right )}\right ) \left (A + B \tan {\left (e \right )} + C \tan ^{2}{\left (e \right )}\right ) & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 11805 vs.
\(2 (352) = 704\).
time = 8.91, size = 11805, normalized size = 33.44 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 9.00, size = 477, normalized size = 1.35 \begin {gather*} x\,\left (A\,a^3\,c+A\,b^3\,d-B\,a^3\,d+B\,b^3\,c-C\,a^3\,c-C\,b^3\,d-3\,A\,a\,b^2\,c-3\,A\,a^2\,b\,d-3\,B\,a^2\,b\,c+3\,B\,a\,b^2\,d+3\,C\,a\,b^2\,c+3\,C\,a^2\,b\,d\right )+\frac {{\mathrm {tan}\left (e+f\,x\right )}^4\,\left (\frac {B\,b^3\,d}{4}+\frac {C\,b^3\,c}{4}+\frac {3\,C\,a\,b^2\,d}{4}\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (\frac {A\,b^3\,d}{3}+\frac {B\,b^3\,c}{3}-\frac {C\,b^3\,d}{3}+B\,a\,b^2\,d+C\,a\,b^2\,c+C\,a^2\,b\,d\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {A\,b^3\,c}{2}-\frac {B\,b^3\,d}{2}+\frac {C\,a^3\,d}{2}-\frac {C\,b^3\,c}{2}+\frac {3\,A\,a\,b^2\,d}{2}+\frac {3\,B\,a\,b^2\,c}{2}+\frac {3\,B\,a^2\,b\,d}{2}+\frac {3\,C\,a^2\,b\,c}{2}-\frac {3\,C\,a\,b^2\,d}{2}\right )}{f}+\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {A\,a^3\,d}{2}-\frac {A\,b^3\,c}{2}+\frac {B\,a^3\,c}{2}+\frac {B\,b^3\,d}{2}-\frac {C\,a^3\,d}{2}+\frac {C\,b^3\,c}{2}+\frac {3\,A\,a^2\,b\,c}{2}-\frac {3\,A\,a\,b^2\,d}{2}-\frac {3\,B\,a\,b^2\,c}{2}-\frac {3\,B\,a^2\,b\,d}{2}-\frac {3\,C\,a^2\,b\,c}{2}+\frac {3\,C\,a\,b^2\,d}{2}\right )}{f}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (B\,a^3\,d-A\,b^3\,d-B\,b^3\,c+C\,a^3\,c+C\,b^3\,d+3\,A\,a\,b^2\,c+3\,A\,a^2\,b\,d+3\,B\,a^2\,b\,c-3\,B\,a\,b^2\,d-3\,C\,a\,b^2\,c-3\,C\,a^2\,b\,d\right )}{f}+\frac {C\,b^3\,d\,{\mathrm {tan}\left (e+f\,x\right )}^5}{5\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________